import Vue from 'vue';
import Vuex from 'vuex';
import { queryUser, userDetail } from '@/api/system/tbSysUser';
Vue.use(Vuex)
const state = {}
const getters = {}
const actions = {
	//获取用户列表数据
	async getUserList({ commit }, data) {
		let result = await queryUser(data).then(res => res.data)
		if (result.code == '0') {
			return {
				count: parseInt(result.count),
				list: !result.data ? [] : result.data
			}
		} else {
			Promise.reject(new Error('faile'));
		}
	},

	//获取用户详细信息
	async getUserInfo({ commit }, data) {
		let result = await userDetail(data).then(res => res.data);
		if (result.code == '0') {
			return !result.data ? {} : result.data[0]
		} else {
			Promise.reject(new Error('faile'));
		}
	}
}
const mutations = {}
export default { state, getters, actions, mutations }